home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt3sp1.arc / INITTERM.PAS < prev    next >
Pascal/Delphi Source File  |  1985-09-09  |  6KB  |  156 lines

  1. (*----------------------------------------------------------------------*)
  2. (*                  InitTerm --- Initialize PibTerm                     *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. OVERLAY PROCEDURE InitTerm;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  InitTerm                                             *)
  10. (*                                                                      *)
  11. (*     Purpose:    Initializes PibTerm                                  *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        InitTerm;                                                     *)
  16. (*                                                                      *)
  17. (*----------------------------------------------------------------------*)
  18.  
  19. VAR
  20.    Done_Flag : BOOLEAN;
  21.    F         : TEXT;
  22.  
  23. BEGIN (* InitTerm *)
  24.                                    (* Get session start time   *)
  25.  
  26.    Session_Start_Time := TimeOfDay;
  27.    Dialing_Start_Time := Session_Start_Time;
  28.  
  29.                                    (* Initialize critical error *)
  30.                                    (* handler routine.          *)
  31.    Int24ON;
  32.                                    (* Initialize handler for    *)
  33.                                    (* other errors.             *)
  34.  
  35.    ErrorPtr := OFS( Error_Handler );
  36.  
  37.                                    (* Clear screen             *)
  38.    ClrScr;
  39.                                    (* Select color/mono screen *)
  40.  
  41.    Get_Screen_Address( Actual_Screen );
  42.  
  43.                                    (* Assume text mode from    *)
  44.                                    (* current system setting.  *)
  45.    CASE Current_Video_Mode OF
  46.  
  47.       0, 2, 7       : Text_Mode := BW80;
  48.       1, 3, 4, 5, 6 : Text_Mode := C80;
  49.  
  50.    END (* CASE *);
  51.  
  52.    TextMode( Text_Mode );
  53.                                    (* Set colors as black and white *)
  54.  
  55.    Set_Global_Colors( White, Black );
  56.  
  57.    ForeGround_Color := White;
  58.    BackGround_Color := Black;
  59.    Menu_Text_Color  := White;
  60.    Menu_Frame_Color := White;
  61.                                    (* Set VT100 colors         *)
  62.  
  63.    VT100_ForeGround_Color := LightGray;
  64.    VT100_BackGround_Color := Black;
  65.    VT100_Underline_Color  := Blue;
  66.    VT100_Bold_Color       := White;
  67.  
  68.                                    (* Set saved screen pointer *)
  69.    Saved_Screen     := NIL;
  70.                                    (* Silent mode OFF to start *)
  71.    Silent_Mode      := FALSE;
  72.                                    (* Local echo starts at OFF *)
  73.    Local_Echo       := FALSE;
  74.                                    (* Gossip mode starts at OFF *)
  75.    Gossip_Mode_On   := FALSE;
  76.                                    (* Host Mode starts at OFF *)
  77.    Host_Mode        := FALSE;
  78.                                    (* Phone number to dial     *)
  79.    Phone_Number     := '';
  80.                                    (* Last column not hit yet  *)
  81.    Last_Column_Hit  := FALSE;
  82.                                    (* Wrap long lines          *)
  83.    Auto_Wrap_Mode   := TRUE;
  84.                                    (* No blinking in effect    *)
  85.    Blinking_On      := 0;
  86.                                    (* No script file being used *)
  87.    Script_File_Mode := FALSE;
  88.                                    (* Set empty review buffer  *)
  89.    Review_Head      := 0;
  90.    Review_Tail      := 0;
  91.    Review_Line      := '';
  92.    Review_Buffer    := NIL;
  93.                                    (* No WHEN string in use    *)
  94.    Script_When_Text       := '';
  95.    Script_When_Reply_Text := '';
  96.    Script_When_Save       := '';
  97.    When_Mode              := FALSE;
  98.                                    (* No WAITSTRING in use     *)
  99.    Script_Wait_Text       := '';
  100.    Script_Wait_Reply_Text := '';
  101.    Script_Wait_Save       := '';
  102.    Script_Wait_Found      := FALSE;
  103.    WaitString_Mode        := FALSE;
  104.    Read_In_Script         := FALSE;
  105.    Really_Wait_String     := FALSE;
  106.    Script_Suspend_Time    := 0.0;
  107.                                    (* No script to start *)
  108.    Script_Buffer          := NIL;
  109.    Script_Buffer_Size     := 0;
  110.  
  111.                                    (* Carrier not set high by default *)
  112.    Modem_Carrier_High     := FALSE;
  113.  
  114.                                    (* Establish Communications *)
  115.  
  116.    IF NOT Set_Params( TRUE , FALSE ) THEN
  117.       BEGIN
  118.          WRITELN('*** Sorry, can''t initialize communications.');
  119.          WRITELN('*** Program stops.');
  120.          Halt;
  121.       END;
  122.                                    (* Give Program Notice *)
  123.  
  124.    WRITELN('PibTerm Version ', PibTerm_Version,' Ready.');
  125.    WRITELN('Hit Alt-I for command list.');
  126.  
  127.                                    (* Initialize Modem         *)
  128.  
  129.    IF Modem_Init <> '' THEN
  130.       BEGIN
  131.          WRITELN('Modem initialization: ',Write_Ctrls( Modem_Init ) );
  132.          Send_Modem_Command( Modem_Init );
  133.          Async_Purge_Buffer;
  134.       END;
  135.                                    (* Pick up script file name if any, *)
  136.                                    (* and convert to executable form.  *)
  137.    IF ParamCount > 0 THEN
  138.       BEGIN
  139.          Script_File_Name := ParamStr( 1 );
  140.          Process_Script;
  141.       END
  142.    ELSE                            (* Check if PIBTERM.SCR exists.     *)
  143.       BEGIN
  144.          ASSIGN( F , 'PIBTERM.SCR' );
  145.             (*$I-*)
  146.          RESET( F );
  147.             (*$I+*)
  148.          IF ( Int24Result = 0 ) THEN
  149.             BEGIN
  150.                CLOSE( F );
  151.                Script_File_Name := 'PIBTERM.SCR';
  152.                Process_Script;
  153.             END;
  154.       END;
  155.  
  156. END   (* InitTerm *);